Notification


Attributes of class N are notificable by an object to another object.

It means that you can say RxMUI to notify an object B when an attribute of an object A changes.

Notification of attributes is really important: you may not take any attention on some events.


Let's suppose you have a radio object A and a cycle object B and you want to connect them so that when the active entry in A changes the active entry of B is changed.

What you must do is to make B SET its attribute ACTIVE everytime the attribute ACTIVE of A changes.

It is done via the call:

    res = Notify("RADIO","ACTIVE","EVERYTIME","CYCLE","SET","ACTIVE","TRIGGERVALUE") 

What we did is to say RxMUI that:
EVERYTIME the attribute ACTIVE of object RADIO changes, invoke the method SET on the object CYCLE with argument ACTIVE and the same value that triggered the notification (TRIGGERVALUE)


Another example:

Let's suppose you have a menuitem object called MABOUTMUI and you want to open the AboutMUI window anytime the user selects that item (APP is an application object):

    res = Notify("MABOUTMUI","MENUTRIGGER","EVERYTIME","APP","ABOUTMUI")

What we did is to say RxMUI that:  
EVERYTIME the item "MABOUTMUI" is selected (and so its attribute MENUTRIGGER changes) invoke the method ABOUTMUI on the object APP


Another example:

Let's suppose you have a button named REMOVE and a Listview named LISTVIEW and you want to remove the active entry in LISTVIEW anytime the REMOVE button is pressed:

    res = Notify("REMOVE","PRESSED",0,"LISTVIEW","REMOVE","ACTIVE")

What we did is to say RxMUI that:  
When the attribute PRESSED of REMOVE is 0 (it means the button was pressed by the user) invoke the method REMOVE on LISTVIEW with argument ACTIVE


The arguments of Notify() are:

<notifier> , <attribute> , <value> , <target> , <method> , {parameters}

The rules are:

  1. Only attribute of class N can trigger the notification (be the second argument in Notify())
  2. If a parameter of the method is triggered the attribute must be of type N or G2N ; it can be S but with len<=64
  3. method bust be a valid method for target
  4. If method is SET: if the parameter is not trigger it must be of the same type of attribute or attribute must be G2N and the parameter N .
  5. Any class defines its rules for its own methods.

 

Since release 3, RxMUI takes care of some potential dangerous situations. The only known way to make RxMUI crash is to set up dead-lock-notifications such as

    call Notify("cycle","active","everytime","radio","set","active","triggervalue")
    call Notify("radio","active","everytime","cycle","set","active","nottriggervalue")

The only way to control such a thing is to check the stack in the dispatcher. The solution is quite easy: if the free stack is less than a fixed value, the invoked method is not executed. It seems to fix the whole problem. The stack limit is hard coded, but it will be user-settable in next RxMUI version, if required.